<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//错误提示
Route::get('error', 'ErrorController@error');
// 后台登录页面
Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function () {
    Route::group(['prefix' => 'login'], function () {
        // 登录页面
        // Route::get('index', 'LoginController@index')->middleware('admin.login');
        Route::get('index', 'LoginController@index')->middleware('adminLogin');
        // 退出
        Route::get('logout', 'LoginController@logout');
        //极验
        Route::get('getVerify', 'LoginController@getVerify')->name('getVerify');
        //登录
        Route::post('login', 'LoginController@login')->name('login');
    });
});
// Admin 模块
Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => 'adminAuth'], function () {
    
    
    // 首页控制器
    Route::group(['prefix' => 'index'], function () {
        // 后台首页
        Route::get('index', ['uses'=>'IndexController@index','auth'=>'admin/index/index']);
    });
    //权限控制器
    Route::group(['prefix' => 'admin'], function () {
        // 管理员列表
        Route::get('adminList', ['uses'=>'AdminController@adminList','auth'=>'admin/admin/adminList']);
        Route::any('addAdmin', ['uses'=>'AdminController@addAdmin','auth'=>'admin/admin/addAdmin']);

        Route::any('editAdmin/{id?}', ['uses'=>'AdminController@editAdmin','auth'=>'admin/admin/editAdmin']);
        Route::post('delAdmin', ['uses'=>'AdminController@delAdmin','auth'=>'admin/admin/delAdmin']);
    });
    //权限控制器
    Route::group(['prefix' => 'role'], function () {
		// 菜单列表
        Route::get('adminNavList', ['uses'=>'RoleController@adminNavList','auth'=>'admin/role/adminNavList']);
		// 编辑菜单
        Route::get('changeNav', ['uses'=>'RoleController@changeNav','auth'=>'admin/role/changeNav']);
		// 删除菜单
        Route::get('delNav', ['uses'=>'RoleController@delNav','auth'=>'admin/role/delNav']);
        // 角色管理
        Route::get('adminGroup', ['uses'=>'RoleController@adminGroup','auth'=>'admin/role/adminGroup']);
        Route::any('addGroup', ['uses'=>'RoleController@addGroup','auth'=>'admin/role/addGroup']);
        Route::any('editGroup/{id?}', ['uses'=>'RoleController@editGroup','auth'=>'admin/role/editGroup']);
        Route::post('delGroup', ['uses'=>'RoleController@delGroup','auth'=>'admin/role/delGroup']);
        // 权限管理
        Route::get('adminPermission', ['uses'=>'RoleController@adminPermission','auth'=>'admin/role/adminPermission']);
        Route::any('addPermission/{pid?}', ['uses'=>'RoleController@addPermission','auth'=>'admin/role/addPermission']);
        Route::any('editPermission/{id?}', ['uses'=>'RoleController@editPermission','auth'=>'admin/role/editPermission']);
        Route::post('delPermission', ['uses'=>'RoleController@delPermission','auth'=>'admin/role/delPermission']);
    });
});